from os.path import dirname, join
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QWidget, QApplication

img_file = join(dirname(__file__), "res", "test.ico")
app = QApplication([])
w = QWidget()
w.setWindowTitle("窗口图标设置示例")
w.setWindowIcon(QIcon(img_file))
w.show()
app.exec_()
